package com.xy6.struct.linklist;

public class LinkedListTest {

	public static void main(String[] args) {
		LinkedList<Integer> elems = new LinkedList<>();
		
		// 新增
		System.out.println(elems.size());
		elems.add(3);
		System.out.println(elems.size());
		elems.add(1);
		System.out.println(elems.size());
		elems.add(2);
		System.out.println(elems.size());
		
		// 查找
		boolean exist = elems.contains(5);
		System.out.println(exist);
		exist = elems.contains(2);
		System.out.println(exist);
		int index = elems.indexOf(2);
		System.out.println(index);
		
		// 删除
		elems.remove(3);
		System.out.println(elems.size());
		elems.remove(2);
		System.out.println(elems.size());
		
		elems.clear();
		System.out.println(elems.size());
	}

}
